package com.itheima02;

public class ThreadDaemonDemo {
    public static void main(String[] args) {
        ThreadDaemon t1 = new ThreadDaemon();
        ThreadDaemon t2 = new ThreadDaemon();

        t1.setName("关羽");
        t2.setName("张飞");

        // 设置主线程为刘备
        Thread.currentThread().setName("刘备");

        // 设置守护线程
        t1.setDaemon(true);
        t2.setDaemon(true);

        t1.start();
        t2.start();

        for (int i = 0; i < 10; i++) {
            System.out.println(Thread.currentThread().getName() + ":" + i);
        }
    }
}
